function [f]=showResVNS(stat,bandName)

f=show(bandName,stat);
m=toMatrix(stat.p_inter,length(stat.areas));    
save(strcat(bandName,'_p-values'),'m');

function f=show(figName,stat)
%labels={'lf';'lc';'lt';'lp';'lo';'rf';'rc';'rt';'rp';'ro';'zz'};
%labels={'mlc','mlf','mlo','mlp','mlt','mrc','mrf','mro','mrp','mrt'};
nAreas=length(stat.areas);

m=toMatrix(stat.h_inter,nAreas);
indxSig=logical(m);


oneVStwo_inter=mean(stat.inter{1},1)-mean(stat.inter{2},1);
oneVStwo_avg=mean(stat.avg{1},1)-mean(stat.avg{2},1);


m=toMatrix(oneVStwo_inter,nAreas);

f=figure;
set(f,'Name',figName)

%subplot(1,2,1)
inter=zeros(nAreas,nAreas);
inter(indxSig)=m(indxSig);
imagesc(inter);
colorbar;
if(stat.h_avgpli)
    title(strcat('significant difference of avg PLI over all channel (anteVNS-postVNS)= ',num2str(oneVStwo_avg)));
else
    title('avg not significant'); 
end
set(gca,'XTickLabel',stat.arealabels);
set(gca,'XTick',1:length(stat.areas));
set(gca,'YTicK',1:length(stat.areas));
set(gca,'YTickLabel',stat.arealabels);
%set(gca,'XGrid','on')
%set(gca,'YGrid','on')

% subplot(1,2,2)
% intra=zeros(nAreas,nAreas);
% indxSig=logical(multi.h_intra);
% spVScomp_intra=mean(multi.intra{1},1)-mean(multi.intra{2},1);
% intra(end,indxSig)=spVScomp_intra(indxSig);
% imagesc(intra)
% colorbar;
% set(gca,'XTickLabel',labels);
% set(gca,'YTickLabel',labels);
% title('significant intra areas');



function m=toMatrix(x,nAreas)
m=zeros(nAreas,nAreas);
k=1;
for i=1:length(m)-1
    for j=i+1:length(m)
        m(i,j)=x(k);
        k=k+1;
    end
end
